<?php

namespace App\Http\Controllers\equity;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Model\Equity;
use Illuminate\Support\Facades\DB;

class DisplayController extends Controller
{
	public function index(){
		return view('equity');
	}

	//填写完表单数据，进行的插入数据库和返回页面结果的操作。
	public function request(Request $request){
		//表单验证
		if($request->isMethod('post')){
			$validate=$this->validate($request,[
				'name'=>'required|min:2|max:4',
				'number'=>'required|min:12|max:12',
				'class'=>'required',
				'phone'=>'required|min:8|max:13',
				'content'=>'required',
			],[
				'required'=>'attribute为必填项',
				'min'=>'attribute长度不符合要求',
				'max'=>'attribute长度不符合要求',
				'integer'=>'attribute必须为数字',
				]  
			,[
				'name'=>'姓名',
				'number'=>'学号',
				'class'=>'班级',
				'phone'=>'电话',
				'content'=>'内容',
			]
			);
		


		}

		$name=$request->input("name");
		$number=$request->input("number");
		$class=$request->input("class");
		$phone=$request->input("phone");
		$content=$request->input("content");
		$title=$request->input("title");
		$select=$request->input("select");
		$bool=Equity::create(
			['name'=>$name,'number'=>$number,'class'=>$class,'content'=>$content,
			'phone'=>$phone,'title'=>$title,'sel'=>$select]
		);
		return $name.$number.$class.$phone.$content.$title.$select;
	}
    
}
